package com.study;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.junit.jupiter.api.Test;

/**
 * jwt令牌校验
 * 失败两种情况
 * 1、令牌被篡改
 * 2、令牌过期
 */
public class JWTParse {
    @Test
    public void testParse(){
        Claims study = Jwts.parser().setSigningKey("study")
                .parseClaimsJws("eyJhbGciOiJIUzI1NiJ9.eyJpZCI6NSwidXNlcm5hbWUiOiJ6aGFuZ3NhbiIsImV4cCI6MTc0MTExNjA4N30.VfOMIwXdhQwT7aW_llRIxPnAUjSunQgox8Ntf71NUEY")
                .getBody();
        System.out.println(study);
    }
}
